<?php

/**
 * Recurso form.
 *
 * @package    ecampus
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class RecursoForm extends BaseRecursoForm
{
    protected function  setupInheritance() {
        parent::setupInheritance();
        $this->useFields(array('id_tipo_recurso','descripcion','imagen_recurso'));
        
       //configuracion de los widgets del formulario
      $this->widgetSchema['id_tipo_recurso'] = new sfWidgetFormChoice(
              array('choices' => Doctrine_Core::getTable('Categoriaderecurso')->getTypes(),
                    'expanded' => false,) );
            //imagen del recurso
      $this->widgetSchema['imagen_recurso'] = new sfWidgetFormInputFile(array('label' => 'Imagen',));
      $this->validatorSchema['imagen_recurso'] = new sfValidatorFile(
              array(
                  'required' => false,
                  'path' => sfConfig::get('sf_upload_dir').'/recursos',
                  'mime_types' => 'web_images',
                  ));
    $this->validatorSchema['imagen_recurso_delete'] = new sfValidatorPass();
    }
//  public function configure()
//  {
//      $this->widgetSchema['id_tipo_recurso'] = new sfWidgetFormChoice(
//              array('choices' => Doctrine_Core::getTable('Categoriaderecurso')->getTypes(),
//                    'expanded' => false,) );
//      $this->widgetSchema['clase_recurso'] = new sfWidgetFormChoice(array(
//          'choices' => Doctrine_Core::getTable('Recurso')->getTypes(),
//          'expanded' => false,
//      ));
//      //imagen del recurso
//      $this->widgetSchema['imagen_recurso'] = new sfWidgetFormInputFileEditable(
//              array(
//                  'label' => 'Imagen',
//                  'file_src' => '/uploads/recursos/'.$this->getObject()->getImagenRecurso(),
//                  'is_image' => true,
//                  'edit_mode' => !$this->isNew(),
//                  'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>',
//                    ));
//      $this->validatorSchema['imagen_recurso_delete'] = new sfValidatorPass();
//
//  }
}
